<template>
	<view class="out">
		<navigator v-for="(item,index) in dataList" :key="item.id"
			:url="'/pages/index/preferentialGroupPurchases/groupPurchaseDetails/groupPurchaseDetails?id='+ item.id">
			<view class="picture">
				<image :src="item.img" mode="aspectFill"></image>
			</view>
			<view class="content">
				<text>{{item.title}}</text>
				<image src="/static/youjiantou.png" mode=""></image>
			</view>
		</navigator>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				dataList: []
			}
		},
		onLoad() {
			this.fetchData();
		},
		methods: {
			fetchData() {
				uni.request({
					url: 'http://localhost/dev-api/business/buying/list',
					method: 'GET',
					header: {
						'Authorization': 'eyJhbGciOiJIUzUxMiJ9.eyJ1c2VyX2lkIjoxLCJ1c2VyX2tleSI6ImRhZTc3OTJmLWU5YmQtNDhlMS05M2VhLWUzMzY1Y2QxNDRlNyIsInVzZXJuYW1lIjoiYWRtaW4ifQ.x5zqYUrXB05k3IDS5uovyCLXp1n7e0dHeAp2vx-OsXQgQS7G_dhciRlL75zghiBfgY4-xU08p1GqljYkOShI-A',
						'Content-Type': 'application/json'
					},
					success: (res) => {
						if (res.statusCode === 200) {
							this.dataList = res.data.rows; // 假设返回的数据直接是数组
						} else {
							uni.showToast({
								title: '数据加载失败',
								icon: 'none'
							});
						}
					},
					fail: () => {
						uni.showToast({
							title: '请求失败',
							icon: 'none'
						});
					}
				});
			}
		}
	}
</script>

<style>
	.picture {
		margin: 20rpx;

	}

	.picture>image {

		width: 100%;
		height: 390rpx;
		background-color: rgba(229, 229, 229, 1);
	}

	.content {
		margin: 30rpx;
		margin-top: -25rpx;
		display: flex;
		font-weight: bold;
		font-size: 14px;
		margin-bottom: -10rpx;

	}

	/* .content>button{
	
	width: 40px;
	height: 30px;
	margin-left: 260rpx;
	background-color: #F5F5F5


} */
	.content>image {
		margin-left: 280rpx;
		width: 24px;
		height: 24px;

	}

	.navigator {}
</style>